package model.effects;

import model.entity.Entity;

public class PushEntity extends Effect{
	private int baseChance;
	PushDirection direction;
	private boolean didEffect;
	
	public PushEntity(int baseChance){
		this.baseChance = baseChance;
		this.didEffect = false;
	}
	@Override
	public void modifyParameter(double modification) {
		double temp = modification * baseChance;
		baseChance = (int) temp;		
	}

	@Override
	public void doEffect(Entity e) {
		if(100*Math.random() <= baseChance){
			//move the entity right here
			this.didEffect = true;
		}
	}
	public void setPushNorth(){
		direction = new PushDirection(){
			public void push(Entity e){
				//move North
			}
		};
	}
	public void setPushSouth(){
		direction = new PushDirection(){
			public void push(Entity e){
				//move North
			}
		};
	}
	public void setPushNorthEast(){
		direction = new PushDirection(){
			public void push(Entity e){
				//move North
			}
		};
	}
	public void setPushNorthWest(){
		direction = new PushDirection(){
			public void push(Entity e){
				//move North
			}
		};
	}
	public void setPushSouthEast(){
		direction = new PushDirection(){
			public void push(Entity e){
				//move North
			}
		};
	}	
	public void setPushSouthWest(){
		direction = new PushDirection(){
			public void push(Entity e){
				//move North
			}
		};
	}
	private abstract class PushDirection{
		public abstract void push(Entity e);
	}
	
	@Override
	public String toString(double factor) {
		double didEffect = this.didEffect ? 1 : 0;
		didEffect += (.01 * factor);
		
		return didEffect > .5 ? "was pushed." : "was not pushed.";
	}
}
